<#-- 导入变量定义文件 -->
<#include "../template/include/assign.ftl">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>权限菜单列表页</title>
<#-- 导入静态资源文件 -->
<#include "../template/include/source.ftl">
<link href="${web_static}/admin/css/list.css" rel="stylesheet" type="text/css" />
<style type="text/css">
	.page{
		float:right;
		padding-top: 15px;
		margin-right: 15px;
	}
</style>
</head>
<#include "../template/template_listPage.ftl">
<script type="text/javascript">
	$().ready( function() {
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>
	
	});
function deleteMenu(code){
	var submit = function (v, h, f) {
                if (v == 'ok')  {
                    var url="${web_base}/system/menu!delete.htm?menuId="+code;
                    document.forms[0].action=url;
					document.forms[0].submit();
                }  else if (v == 'cancel')  {

                }
                return true; //close
            };
     $.jBox.confirm("你确认要删除吗?", "温罄提示", submit);
 }

function refresh(){
	$.post("${web_base}/system/menu!refresh.htm");
	var hf=location.href;
	if(hf.indexOf("?")>0)
			hf=hf+"&ts="+Math.random();
	else
		hf=hf+"?ts="+Math.random();
	setTimeout(function(){location.href=hf;},3000);
}
</script>
</head>
<body class="list">
	<div class="body">
		<div class="listBar">
			<h1><span class="icon">&nbsp;</span>菜单管理&nbsp;<span class="pageInfo"></span></h1>
		</div>
		<@pageList page=(page!) id="list" action="${web_base}/system/menu!list.htm" query="menuQuery" isEmpty=true>
			<div class="operateBar">
				<input type="button" class="addButton" onclick="location.href='${web_base}/system/menu!add.htm'" value="添加1级菜单" />
				<input type="button" class="addButton" onclick="refresh()" value="刷新缓存" />
				<label>查找:</label>
				上级菜单代码:
				<input type="text" name="menuQuery.menuParent" value="${(menuQuery.menuParent)!}">
				菜单/权限名
				<input type="text" name="menuQuery.menuName" value="${(menuQuery.menuName)!}">
				菜单级别
				<select name="menuQuery.menuLevel">
				    <option value="" >请选择</option>
					<option value="1" <#if menuQuery?? && menuQuery.menuLevel?? && menuQuery.menuLevel==1>selected="selected"</#if> >1</option>
					<option value="2" <#if menuQuery?? && menuQuery.menuLevel?? && menuQuery.menuLevel==2>selected="selected"</#if> >2</option>
					<option value="3" <#if menuQuery?? && menuQuery.menuLevel?? && menuQuery.menuLevel==3>selected="selected"</#if> >3</option>
				</select>
				
				<input type="submit" id="searchButton" class="searchButton" value="" />
			</div>
			<table class="listTable">
				<tr>
					<th>
						<span class="sort" name="menuId">菜单编号</span>
					</th>
					<th>
						<span class="sort" name="menuName">菜单名称</span>
					</th>
					<th>
						<span class="sort" name="menuLevel">菜单级别</span>
					</th>
					<th>
						<span class="sort" name="sort">菜单排序</span>
					</th>
					<th>
						<span class="sort" name="url">菜单URL</span>
					</th>
					<th>操   作<th/>
				</tr>
				<#if  page??&&page.list??&&(page.list?size gt 0) >			
				<#list page.list as obj>
					<tr>
						<td>
							${(obj.menuId)!}
						</td>
						<td>
							<a href="${web_base}/system/menu!list.htm?menuQuery.menuParent=${(obj.menuId)!}">${(obj.menuName)!}</a>
							&nbsp;
						</td>
						<td>
							${(obj.menuLevel)!}
						</td>
						<td>
							${(obj.menuSort)!}
						</td>
						<td>
							${(obj.menuUrl)!}
						</td>
						<td>
						    <#if obj.menuLevel?default("0")==1>
						    	<a href="${web_base}/system/menu!add.htm?menuId=${(obj.menuId)!}&menuLevel=2" title="添加2级菜单">[添加2级菜单]</a>
						    <#elseif obj.menuLevel?default("0")==2>
						    	<a href="${web_base}/system/menu!add.htm?menuId=${(obj.menuId)!}&menuLevel=3" title="添加3级菜单">[添加3级菜单]</a>
							</#if>
							<a href="${web_base}/system/menu!toEdit.htm?menuId=${(obj.menuId)!}" title="编辑">[编辑]</a>
							<span class="spanLink" onclick="deleteMenu('${(obj.menuId)!}')" title="删除">[删除]</span>
						</td>
					</tr>
				</#list>
				<#else>
				    <tr><td colspan="9">
					<div class="noRecord">
						没有找到任何记录!
					</div>	
					</td></tr>
				</#if>	
			</table>

		</@pageList>
	</div>
	
</body>
</html>